package com.jian.java.controller;

import org.springframework.web.bind.annotation.*;

import javax.servlet.http.Cookie;
import java.util.Map;

/**
 * @author Jiange
 * @create 2021-04-28-15:17
 */
@RestController
public class MyController {
    @DeleteMapping("/test")
    public String test(@RequestParam Map<String,String> content,@RequestHeader Map<String,String> map, @CookieValue("Idea-1c604217") String value,@CookieValue("Idea-1c604217") Cookie cookie){
        content.forEach((name,val)-> {
            System.out.print(name+"\t");
            System.out.println(val);
        });
        /**
         * 矩阵变量：
         *  /car/text;a=10;b=1,2,3
         */
        System.out.println(cookie.getValue());
        System.out.println(value);
        return map.toString();
    }

    @GetMapping("/a/{path}")
    @CrossOrigin({"http://localhost:8080"})
    public void test1(@MatrixVariable(pathVar = "path") Map<String,String> map,@PathVariable("path") String path){
        map.forEach((name,value)->{
            System.out.print(name);
            System.out.println(value);
        });

        System.out.println(path);
        /**
         * name李子建
         * age18
         * 1
         */
    }
}
